(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
p(0) → 0
p(s(X)) → X
leq(0, Y) → true
leq(s(X), 0) → false
leq(s(X), s(Y)) → leq(X, Y)
if(true, X, Y) → X
if(false, X, Y) → Y
diff(X, Y) → if(leq(X, Y), 0, s(diff(p(X), Y)))
Rewrite Strategy: FULL
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
p(0') → 0'
p(s(X)) → X
leq(0', Y) → true
leq(s(X), 0') → false
leq(s(X), s(Y)) → leq(X, Y)
if(true, X, Y) → X
if(false, X, Y) → Y
diff(X, Y) → if(leq(X, Y), 0', s(diff(p(X), Y)))
S is empty.
Rewrite Strategy: FULL
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
TRS:
Rules:
p(0') → 0'
p(s(X)) → X
leq(0', Y) → true
leq(s(X), 0') → false
leq(s(X), s(Y)) → leq(X, Y)
if(true, X, Y) → X
if(false, X, Y) → Y
diff(X, Y) → if(leq(X, Y), 0', s(diff(p(X), Y)))
Types:
p :: 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
leq :: 0':s → 0':s → true:false
true :: true:false
false :: true:false
if :: true:false → 0':s → 0':s → 0':s
diff :: 0':s → 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
leq,
diffThey will be analysed ascendingly in the following order:
leq < diff
(6) Obligation:
TRS:
Rules:
p(
0') →
0'p(
s(
X)) →
Xleq(
0',
Y) →
trueleq(
s(
X),
0') →
falseleq(
s(
X),
s(
Y)) →
leq(
X,
Y)
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Ydiff(
X,
Y) →
if(
leq(
X,
Y),
0',
s(
diff(
p(
X),
Y)))
Types:
p :: 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
leq :: 0':s → 0':s → true:false
true :: true:false
false :: true:false
if :: true:false → 0':s → 0':s → 0':s
diff :: 0':s → 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
leq, diff
They will be analysed ascendingly in the following order:
leq < diff
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
leq(
gen_0':s3_0(
n5_0),
gen_0':s3_0(
n5_0)) →
true, rt ∈ Ω(1 + n5
0)
Induction Base:
leq(gen_0':s3_0(0), gen_0':s3_0(0)) →RΩ(1)
true
Induction Step:
leq(gen_0':s3_0(+(n5_0, 1)), gen_0':s3_0(+(n5_0, 1))) →RΩ(1)
leq(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
TRS:
Rules:
p(
0') →
0'p(
s(
X)) →
Xleq(
0',
Y) →
trueleq(
s(
X),
0') →
falseleq(
s(
X),
s(
Y)) →
leq(
X,
Y)
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Ydiff(
X,
Y) →
if(
leq(
X,
Y),
0',
s(
diff(
p(
X),
Y)))
Types:
p :: 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
leq :: 0':s → 0':s → true:false
true :: true:false
false :: true:false
if :: true:false → 0':s → 0':s → 0':s
diff :: 0':s → 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
leq(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
diff
(10) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol diff.
(11) Obligation:
TRS:
Rules:
p(
0') →
0'p(
s(
X)) →
Xleq(
0',
Y) →
trueleq(
s(
X),
0') →
falseleq(
s(
X),
s(
Y)) →
leq(
X,
Y)
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Ydiff(
X,
Y) →
if(
leq(
X,
Y),
0',
s(
diff(
p(
X),
Y)))
Types:
p :: 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
leq :: 0':s → 0':s → true:false
true :: true:false
false :: true:false
if :: true:false → 0':s → 0':s → 0':s
diff :: 0':s → 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
leq(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(12) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
leq(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(13) BOUNDS(n^1, INF)
(14) Obligation:
TRS:
Rules:
p(
0') →
0'p(
s(
X)) →
Xleq(
0',
Y) →
trueleq(
s(
X),
0') →
falseleq(
s(
X),
s(
Y)) →
leq(
X,
Y)
if(
true,
X,
Y) →
Xif(
false,
X,
Y) →
Ydiff(
X,
Y) →
if(
leq(
X,
Y),
0',
s(
diff(
p(
X),
Y)))
Types:
p :: 0':s → 0':s
0' :: 0':s
s :: 0':s → 0':s
leq :: 0':s → 0':s → true:false
true :: true:false
false :: true:false
if :: true:false → 0':s → 0':s → 0':s
diff :: 0':s → 0':s → 0':s
hole_0':s1_0 :: 0':s
hole_true:false2_0 :: true:false
gen_0':s3_0 :: Nat → 0':s
Lemmas:
leq(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
leq(gen_0':s3_0(n5_0), gen_0':s3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(16) BOUNDS(n^1, INF)